home *** CD-ROM | disk | FTP | other *** search
Wrap
/* OPAL MOVING BRUSH By J.L. White ©1994 Merlin's Software Load Images & Add A Moving Brush To Series Of Frames Opal Paint Script Requires The Rexxarplib.library Batch Factory Batch Conversion Scripts are basically Arexx scripts that allow you to pass certain parameters to the external program you wish to use to convert the images from one format to another. You can pass five different strings from Batch Factory to the script by using the following commands: $N = This will pass the current selected filename. $P = This will tell Batch Factory to ask for a path to save new frames to. $# = This will pass the current frame number in the script. $T = This will pass the total number of frames in the script. $A = This will pass an offset number to be used to save frames with. NOTE: The following line is required to work as a Batch Factory Script: PARSE=$N $P $# $A $T */ if ~show('l', "rexxarplib.library") then do check = addlib('rexxsupport.library',0,-30,0) check = addlib('rexxarplib.library',0,-30,0) end options results arg InPic OutPic FrameNum AddNum TotalNum SaveNum = FrameNum + AddNum if FrameNum = 1 then do Top = 170 Height = ScreenRows("Batch") if Height < 400 then Top = 70 address "AREXX" ScreenToFront("Batch") call GetMotionPath call Locate_OpalPaint address "OpalPaint_Rexx" SaveSetUp SetPrefs 1024 AskBool "Select Save Format You Wish To Use?\n\n Select [OK] For IFF \n\n Select [CANCEL] For JPEG" if Result=0 then do AskProp 1 100 84 "Enter JPEG Compression Value (1 - 100)!" Format = JPEG Result end else Format = IFF Saver Format ActiveBrush 1 AskFileName 'Select Image To Use For Brush! RAM: ' LoadBrush result AskBool "Do You Wish To Add A Shadow To Your Brush?" if Result=0 then Answer = "NO" else do Answer = "YES" AskProp 1 10 3 "Enter Shadow Depth (1 - 10)!" Answer2 = result Answer = "YES" AskProp 1 100 19 "Enter Shadow Darkness (1 - 100)!" Answer3 = result end Key "j" call open TempFile,"Ram:OMB",W call writeln TempFile,Answer call writeln TempFile,Answer2 call writeln TempFile,Answer3 call close TempFile end else do call open TempFile,"Ram:OMB",R line = readln(TempFile) parse var line Answer line = readln(TempFile) parse var line Answer2 line = readln(TempFile) parse var line Answer3 call close TempFile end address "OpalPaint_Rexx" ActiveColor 1 Load InPic PageSize MainPage = result parse var MainPage Width Height ActiveBrush 1 ColourSource MULTICOLOR HandleCenter call GetXYCords AntiAlias 1 100 if Answer = "YES" then do ColourSource PAINTPOT NewX = X + Answer2 NewY = Y + Answer2 if NewX > (Width-1) then NewX = Width-1 if NewY > (Height-1) then NewY = Height-1 SetPot 1 255 255 255 ActivePot 1 SetDrawMode 3 Answer3 PutBrush NewX NewY end ColourSource MULTICOLOR SetDrawMode 1 PutBrush X Y AntiAlias 0 if OutPic = "SAME" then Save InPic else Save OutPic""right(SaveNum,3,'0') if FrameNum = TotalNum then do RestoreSetUp Key "AMIGA w" address command "wait 1" address command "Delete >NIL: Ram:OMB" address command "Delete >NIL: RAM:TimeLine.File" end exit Locate_OpalPaint: if (POS('OpalPaint_Rexx',SHOW('Ports')) = 0) then do address command 'run < nil: > nil: OpalPaint:OpalPaint -q' address command 'wait 5' end return GetMotionPath: address arexx "'call CreateHost(BFHOST,BFPORT,"MOUSESCREEN")'" call Delay(30) Width = 320 Height = 200 XOff = 0 YOff = 0 call Request(190,(Top+6)-14,"Select Screen Width Of Images!",,"HIRES","LORES","Batch") if result = "OKAY" then do Settings = "HIRES" Width = 640 end else Settings = "" call Request(180,(Top+6)-14,"Select Screen Height Of Images!",,"LACE","NOLACE","Batch") if result = "OKAY" then do Settings = Settings"+LACE" Height = 400 end if Height = 400 & Width = 640 then do call Request(185,(Top+6)-14," Select Over Scan Option!",,"OVERSCAN","REGULAR","Batch") if result = "OKAY" then do Settings = Settings"+OVERSCAN+AUTOSCROLL" call Request(180,(Top+6)-14," Enter New Screen Width!","736","OKAY",,"Batch") Width = result XOff = 640 - Width call Request(180,(Top+6)-14," Enter New Screen Height!","480","OKAY",,"Batch") Height = result YOff = 400 - Height end end result = OpenScreen(YOff,3,Settings,'','MOUSESCREEN',,Width,Height,XOff) Height = ScreenRows("MOUSESCREEN") Width = ScreenCols("MOUSESCREEN") idcmp = 'CLOSEWINDOW+GADGETUP+MOUSEMOVE+MOUSEBUTTONS' flags = 'BORDERLESS+BACKDROP+REPORTMOUSE' call OpenWindow(BFHOST, 0, 0, Width, Height, idcmp, flags, ) call ShowTitle("MOUSESCREEN",0) call ModifyHost(BFHOST, MOUSEMOVE, "%l %x %y") call ModifyHost(BFHOST, MOUSEBUTTONS, "%b %x %y") call AddGadget(BFHOST,15,8,"OK"," OKAY ","OK") SetAPen(BFHOST,1) SetDrMd(BFHOST,JAM2) call Move(BFHOST,0,Height%2) call Draw(BFHOST,Width,Height%2) call Move(BFHOST,Width%2,0) call Draw(BFHOST,Width%2,Height) call Move(BFHOST,0,0) call Draw(BFHOST,0,Height) call Move(BFHOST,0,0) call Draw(BFHOST,Width,0) call Move(BFHOST,Width-1,0) call Draw(BFHOST,Width-1,Height) call Move(BFHOST,0,Height-1) call Draw(BFHOST,Width,Height-1) call ActivateWindow(BFHOST) call Request((Width-304)%2,(Height-60)%2,"Draw Line By Moving The Mouse.\Click Mouse To Change Direction.\Click OKAY When You Are Done.",,"OK",,"MOUSESCREEN") xpos = 0 ypos = 0 xm = -1 ym = -1 quitflag = 0 Start = 0 i = 0 call openport(BFPORT) do until quitflag = 1 call waitpkt(BFPORT) packet = getpkt(BFPORT) if packet ~= null() then do cmd = getarg(packet) call reply(packet,0) if cmd = OK then do call Move(BFHOST,xpos,ypos) call Draw(BFHOST,xm,ym) call ImageOK end else do parse var cmd button x y if (button == 'MOUSEMOVE' & Start > 0) then do call Move(BFHOST,xpos,ypos) call Draw(BFHOST,xm,ym) xm = x ym = y call SetDrMd(BFHOST,COMPLEMENT) call Move(BFHOST,xpos,ypos) call Draw(BFHOST,xm,ym) end else if button == 'SELECTDOWN' then do Start = Start + 1 if Start = 1 then do xpos = x ypos = y i = i + 1 XPosition.i = xpos YPosition.i = ypos xm = x ym = y call SetDrMd(BFHOST,COMPLEMENT) call Move(BFHOST,xpos,ypos) call Draw(BFHOST,xm,ym) call PrintText end end else if(button == 'SELECTUP') then do i = i + 1 if x = Width - 1 then x = Width if y = Height - 1 then y = Height XPosition.i = x YPosition.i = y call PrintText xpos = x ypos = y end end end end call CloseWindow(BFHOST) result = CloseScreen('MOUSESCREEN') call ClosePort(BFPORT) return AbortIt: call CloseWindow(BFHOST) result = CloseScreen('MOUSESCREEN') call ClosePort(BFPORT) call Request(200,(Top+36)-14,"Process Has Been Cancelled\Please Abort Script!!",,"OK",,"Batch") address command "Wait 2" exit return ImageOK: call Request((Width-232)/2,(Height-70)/2,"Is The Time Line Correct?",,"OK","CANCEL","MOUSESCREEN") if result = "OKAY" then do quitflag = 1 call open OutData,"RAM:TimeLine.File",'W' do x = 2 to i call writeln OutData,XPosition.x" "YPosition.x end call close OutData end else do xpos = 0 ypos = 0 xm = -1 ym = -1 Start = 0 i = 0 call BackFill(BFHOST) call RefreshGadgets(BFHOST) SetAPen(BFHOST,1) SetDrMd(BFHOST,JAM2) call Move(BFHOST,0,Height/2) call Draw(BFHOST,Width,Height/2) call Move(BFHOST,Width/2,0) call Draw(BFHOST,Width/2,Height) call Move(BFHOST,0,0) call Draw(BFHOST,0,Height) call Move(BFHOST,0,0) call Draw(BFHOST,Width,0) call Move(BFHOST,Width-1,0) call Draw(BFHOST,Width-1,Height) call Move(BFHOST,0,Height-1) call Draw(BFHOST,Width,Height-1) end return PrintText: SetAPen(BFHOST,1) SetDrMd(BFHOST,JAM2) call Move(BFHOST,85,16) YText = strip(y) call Text(BFHOST,"Key Frame #"right(i-1,3,'0')" X="right(x,3,'0')" Y="right(YText,3,'0')) SetAPen(BFHOST,2) SetDrMd(BFHOST,JAM1) return GetXYCords: i = 0 call open KeyData,"RAM:TimeLine.File",'R' do until eof(KeyData) i = i + 1 line = readln(KeyData) parse var line XCord.i' 'YCord.i end call close KeyData TotalKey = i-2 NumKey = (TotalNum/TotalKey) FirstNum = ((NumKey - (NumKey-(FrameNum-1)))%NumKey)+1 SecNum = FirstNum+1 if FirstNum = TotalKey then do NumKey = NumKey - 1 NewNum = (((FrameNum-((FirstNum-1)*NumKey)))-(TotalKey-1)) end else NewNum = ((FrameNum-((FirstNum-1)*NumKey))) X1 = XCord.FirstNum Y1 = YCord.FirstNum X2 = XCord.SecNum Y2 = YCord.SecNum if X2 < X1 then do DiffX = -((X1-X2)/(NumKey)) end else do DiffX = ((X2-X1)/(NumKey)) end if Y2 < Y1 then do DiffY = -((Y1-Y2)/(NumKey)) end else do DiffY = ((Y2-Y1)/(NumKey)) end X = (X1 + (DiffX*NewNum))-DiffX Y = (Y1 + (DiffY*NewNum))-DiffY X = X % 1 Y = Y % 1 return